<template>
  <div class="tabbar">
    <div @click="changeIndex(i, item)" class="item" v-for="(item, i) in tabbarDate" :key="i"><img
        v-if="i === currentIndex" :src="item.imageActive" alt="">
      <img v-else :src="item.image" alt="">
      <span>{{ item.text }}</span>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import tabbarDate from "../../assets/data/tabbar";
let currentIndex = ref(0)
let router = useRouter()
function changeIndex(index, item) {
  currentIndex.value = index;
  router.push(item)
}
</script>
<style lang="less" scoped>
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border: 1px solid #f3f3f3;
  background-color: #fff;
}

.item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  img {
    width: 35px;
  }

  span {
    font-size: 12px;
    margin-top: 2px;
  }
}
</style>